<center>
	<?php 
		if(!isset($_POST["user"]))	//没有内容显示表单
		{
	 ?>
	<table border="1">
		<form action="login.php" method="post">
			<tr>
				<td colspan="2" align="center">用户登录</td>
			</tr>
			<tr>
				<td>输入用户名称:</td>
				<td>
					<input type="text" name="user">
				</td>
			</tr>
			<tr>
				<td>输入用户密码:</td>
				<td>
					<input type="password" name="pass">
				</td>
			</tr>
			<tr>
				<td colspan="2">
					<input type="submit" value="登录">
				</td>
			</tr>
		</form>
	</table>
	<?php 
	 }
	 else
	 {
		 include "config.php";
		 $user = $_POST["user"];
		 $pass = $_POST["pass"];
		 $sql = "select count(10) from $test_user where name='$user' and pass='$pass'";
		 $result = $mysqli->query($sql);
		 $num=$result->num_rows;	//查询
		 if($num==0){
			 echo "<p>用户名或密码错误!</p>";
			 echo "<p>单击<a href='login.php'>这里</a>重新登录</p>";
		 }
		 else{
				 setcookie("user",$user);
				 echo "<p>成功登录</p>";
				 echo "<p>单击<a href='index.php'>这里</a>进入系统</p>";
		 }
		 
	 }
	 ?>
</center>